#include <bits/stdc++.h>
using namespace std;
class BinaryTreeNode{
public:
    int data;
    BinaryTreeNode* lchild;
    BinaryTreeNode* rchild;
    BinaryTreeNode(int d,BinaryTreeNode* l= nullptr,BinaryTreeNode* r=nullptr)
    {
        lchild = l;
        rchild = r;
        data = d;
    }
};
int TreeDeepth(BinaryTreeNode* root)
{
    if(root == nullptr)
        return 0;
    else{
        int ldeepth = TreeDeepth(root->lchild);
        int rdeepth = TreeDeepth(root->rchild);
        return ldeepth>rdeepth?(1+ldeepth):(1+rdeepth);
    }
}
int main() {
    BinaryTreeNode* root = new BinaryTreeNode(1);
    BinaryTreeNode* a = new BinaryTreeNode(2);
    BinaryTreeNode* b = new BinaryTreeNode(3);
    BinaryTreeNode* c = new BinaryTreeNode(4);
    BinaryTreeNode* d = new BinaryTreeNode(5);
    BinaryTreeNode* e = new BinaryTreeNode(6);
    BinaryTreeNode* f = new BinaryTreeNode(7);
    root->lchild = a;
    root->rchild = b;
    a->lchild = c;
    a->rchild = d;
    b->rchild = e;
    d->lchild = f;
    cout<<TreeDeepth(root)<<endl;
    delete root,a,b,c,d,e,f;
    return 0;
}